using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace blog.Filter
{
    public class GlobleActionFilter : ActionFilterAttribute 
    {
        override public void OnActionExecuting(ActionExecutingContext context)
        {
            return;
            byte[] result;
            context.HttpContext.Session.TryGetValue("user_account", out result);
            if (result == null)
            {
                context.Result = new RedirectResult("/Login/Index");
                return;
            }
            string token;
            string token2;
            token = context.HttpContext.Session.GetString("access_token");
            context.HttpContext.Request.Cookies.TryGetValue("access_token", out token2);
            if (string.IsNullOrEmpty(token2) == true || token.Equals(token2) == false)
            {
                context.Result = new RedirectResult("/Login/Index");
                return;
            }

            base.OnActionExecuting(context);
        }
    }
}
